package i_oStream;

import java.io.*;
import java.nio.charset.Charset;

public class ReverseStream {
    public static void main(String[] args) throws IOException {
        //利用转换流拷贝文件
        //关联本地文件并使用指定字符集读取文件
        FileReader fr = new FileReader("D:\\not\\xuruiqi.txt", Charset.forName("gbk"));
        //关联本地文件并使用指定字符集写入文件
        FileWriter fw = new FileWriter("D:\\not\\xuruiqicopy.txt", Charset.forName("gbk"));

        int i;
        while ((i = fr.read()) != -1) {
            fw.write(i);
        }
        fr.close();
        fw.close();
        //字节流一次读一行
        BufferedReader bf = new BufferedReader(new InputStreamReader(new FileInputStream("D:\\not\\xuruiqicopy.txt")));
        System.out.println(bf.readLine());
        bf.close();
    }
}
